package com.zoke.loveway.ui;

import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;

import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.zoke.loveway.R;

/**
 * 过渡页
 * 
 * @author Jack
 *
 */
@ContentView(R.layout.activity_splash)
public class Splash extends LoveWayUI {
	@ViewInject(R.id.rootContainer)
	private View mRootContainer;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AlphaAnimation anim = new AlphaAnimation(0.4f, 1.0f);
		anim.setDuration(2500);
		anim.setFillAfter(true);
		anim.setAnimationListener(new AnimationListener() {
			@Override
			public void onAnimationStart(Animation animation) {
			}

			@Override
			public void onAnimationRepeat(Animation animation) {
			}

			@Override
			public void onAnimationEnd(Animation animation) {
				// 判断是否增加欢迎页
				Welcomes.openWelcomes();
				finish();
			}
		});
		mRootContainer.startAnimation(anim);
	}
}
